 ///api/product/getBaseCategoryList
 import requests from './request'
 import mockRequests from './mockAjax'

 //Home
 export const reqCategoryList = () => {
    //发请求 axios发请求返回Promise对象
    return requests({
       url: '/product/getBaseCategoryList',
       method: 'get'
    })
 }
 //获取banner（Home首页轮播图接口）
 export const reqGetBannerList = () => mockRequests.get("/banner");
 //获取floor（Home首页轮播图接口）
 export const reqGetFloorList = () => mockRequests.get("/floor");

 //Search
 export const reqGetSearchInfo = (searchParams) => requests.post('/list', searchParams)
 // Detail
 export const reqGetDetailInfo = (skuId) => {
    //发请求 axios发请求返回Promise对象
    return requests({
       url: `/item/${skuId}`,
       method: 'get'
    })
 }

 // Detail  产品添加到购物车中
 export const reqAddOrUpdateShopCart = (skuId, skuNum) => {
    //发请求 axios发请求返回Promise对象
    return requests({
       url: `/cart/addToCart/${skuId}/${skuNum}`,
       method: 'post'
    })
 }

 // cartList
 // 获取购物车列表的数据结构  /api/cart/cartList
 export const reqCartList = () => {
    return requests({
       url: `/cart/cartList`,
       method: 'get'
    })
 }
 export const reqDeleteCartById = (skuId) => {
    return requests({
       url: `/cart/deleteCart/${skuId}`,
       method: 'DELETE'
    })
 }
 export const reqUpdateCheckedById = (skuId, isChecked) => {
    return requests({
       url: `/cart/checkCart/${skuId}/${isChecked}`,
       method: 'GET'
    })
 }

 // 注册业务
 // 获取验证码
 export const reqGetCode = (phone) => {
    return requests({
       url: `/user/passport/sendCode/${phone}`,
       method: 'GET'
    })
 }
 // 注册手机号
 export const reqUserRegister = (data) => {
    return requests({
       url: `/user/passport/register`,
       data,
       method: 'POST'
    })
 }

 // 登录业务
 export const reqUserLogin = (data) => {
    return requests({
       url: `user/passport/login`,
       data,
       method: 'POST'
    })
 }
 // 获取用户信息
 export const reqUserInfo = () => {
    return requests({
       url: `user/passport/auth/getUserInfo`,
       method: 'GET'
    })
 }
 // 退出登录
 export const reqLogout = () => {
    return requests({
       url: `user/passport/logout`,
       method: 'GET'
    })
 }

 // 交易业务/api/user/userAddress/auth/findUserAddressList
 // 获取地址
 export const reqfindUserAddressList = () => {  
   return requests({
      url: `user/userAddress/auth/findUserAddressList`,
      method:'GET'
   })
 }
//  获取商品交易详情/api/order/auth/trade
export const reqOrderTrade = ()=>{
   return requests({
      url:`order/auth/trade`,
      method:'GET'
   })
}
// 获取订单详细信息/api/order/auth/submitOrder?tradeNo={tradeNo}
export const reqsubmitOrder = (tradeNo,data)=>{
   return requests({
      url:`order/auth/submitOrder?tradeNo=${tradeNo}`,
      data,
      method:'POST'
   })
}
// 获取支付信息
export const reqPayInfo = (orderId)=>{
   return requests({
      url:`/payment/weixin/createNative/${orderId}`,
      method:'GET'
   })
}
// 获取支付订单状态
export const reqPaystatus = ()=>{
   return requests({
      url:`/payment/weixin/queryPayStatus/{orderId}`,
      method:'GET'
   })
}